1. Technical Field
The present invention relates generally to setting of the origin of a surface texture measuring machine represented by a roundness measuring machine, a surface roughness tester, a contour measuring machine and a three (3)-dimensional coordinate measuring machine and, more specifically, to a method, a program and a device for workpiece coordinate system origin setting.
2. Background Art
A detector used in a surface texture measuring machine such as a roundness measuring machine, a surface roughness tester and a contour measuring machine and having a structure in which a stylus is provided at the tip of a lever capable of shaking freely in a direction perpendicular to the surface of a workpiece is widely used. In a state where the stylus is in contact with the surface of a workpiece, data are collected by scanning the detector in the direction along the surface of the workpiece. Based on the data obtained as described above, the surface texture of the workpiece is analyzed, the coordinates of the workpiece are obtained and the dimensions of the workpiece are obtained.
Now, since a detector having such a structure is a one (1)-axis detector detecting the unevenness in the direction of its shaking (Z-axis direction being the vertical direction for a detector of a surface roughness tester and a contour measuring machine and, X-axis direction being the direction to back and forth for a detector of a roundness measuring machine), the data of the surface of a workpiece in the direction perpendicular to the shaking direction are difficult to obtain. For example, it is difficult to detect directly a portion having a feature in its shape such as an edge of a workpiece (that is a corner portion of the workpiece and often forms an angle of 90° in general).
Thus, conventionally, the shape of the workpiece is estimated and feature portions of the workpiece are estimated by analyzing the shape of the scanning locus based on the data obtained by scanning the detector along the surface of a workpiece.
For example, FIG. 17 shows a scanning locus K drawn by the central point of a contacting ball Q when a stylus S having the contacting ball Q at its tip is scanned over an area including a workpiece edge We, along the surface of a workpiece W in order to collect the data necessary for analyzing the shape of the workpiece.
The arrow of the scanning locus K shows the direction of scanning. The scanning locus K is a row of points in an actual case. When the tip of the stylus is not ball-shaped but partially a ball such as an arc, the scanning locus is drawn by the central point of the arc. A point “A” on the scanning locus K indicates the starting point of the scanning of the central point of the contacting ball and a point D indicates the edge point of the scanning.
In FIG. 17, the portion of the scanning locus K from the point A to a point B is almost a straight line since scanning is carried out in a state where the lower tip of the contacting ball Q is in contact with the workpiece W. During the scanning from the point B to a point C of the scanning locus K, the ball tip portion (a slanting side portion) of the contacting ball Q gradually changes its contacting point relative to the workpiece edge We. Consequently, the scanning locus from the point B to the point C is an arc in which the ball shape of the contacting ball Q is transferred. For the portion of the scanning locus K from the point C to a point D, the scanning locus K is almost a straight line within this region since the left side of the contacting ball Q has scanned the right side of the workpiece W.
Conventionally, the point B or the point C of the scanning locus K obtained as above, or the intersection of a line AB and a line CD are obtained using a form analysis, and the origin of the workpiece coordinate system is set based on those points and the intersection obtained.
Here, as methods for the form analysis, for example, those described in Japanese Patent Application Laid-Open Pub. Nos. Hei11-339052 and 2000-331171 can be used. However, those methods are not for setting the origin.
For example, according to the form analysis method described in Japanese Patent Application Laid-Open Pub. No. Hei11-339052, the shape of a workpiece is estimated by executing a geometrical element analysis according to a procedure described as follows.    (1) A portion of input data (the initial fitting portion) is extracted.    (2) Fitting is executed for the initial fitting portion using a evaluation function.    (3) A radius of curvature R is obtained from the obtained parameters.    (4) The shape of the initial fitting portion is determined to be a line element when the radius of curvature of the portion is larger than a predetermined value, and to be a circular element when the radius of the curvature of the portion is smaller than the predetermined value.    (5) Parameters of the element determined (a line or a circle) are obtained.    (6) εi=f(x, y) is obtained using these parameters and a fitting function and errors are checked one by one from i=1.    (7) If “i” has exceeded the initial fitting portion, steps (2)-(6) are repeated further adding data one by one until an error εi exceeds a predetermined value.    (8) Adjacent elements are determined by repeating again the steps (1)-(7) from the data with which the error εi has exceeded the predetermined value as a starting point.    (9) Steps (1)-(8) are repeated for all the input data.    (10) Intersections are obtained by extending the geometrical elements.    (11) If the distance from an input data to an intersection has exceeded a predetermined value, edge points of adjacent elements are connected to each other with connecting lines.
According to the form analysis method described in Japanese Patent Application Laid-Open Pub. No. 2000-331171, the shape of a workpiece is estimated by executing a geometrical element analysis according to a procedure described as follows.    (1) A portion of input data (the initial fitting portion) is extracted.    (2) Fitting is executed for the initial fitting portion using a plurality of evaluation functions.    (3) If an error of the initial fitting portion is within the tolerance provided to each shape element, the initial fitting portion is extended as its shape element and the steps (2)-(3) are repeated.    (4) The shape element for which the initial fitting portion can be extended longest is determined as the shape element for a first portion.    (5) Steps (1)-(4) are repeated with the next data of the first portion as their starting point.    (6) Steps (1)-(5) are repeated for all the data.    (7) Intersections are obtained by extending both of adjacent geometrical elements as their elements.    (8) If the distance from an input data to an intersection has exceeded a predetermined value, edge points of adjacent elements are connected to each other with connecting lines.
Furthermore, conventionally, there is a method according to which the origin of the coordinate system of a workpiece is set based on intersections of the shape elements analyzed by executing a form analysis of a scanning locus of a stylus (for example, Japanese Patent Application Laid-Open Pub. No. 2002-270307).
However, a calculation process accompanied by a complicated analysis is necessary for the data in order to estimate feature points such as an edge portion of a workpiece and to set a feature point correctly as the origin of the workpiece coordinate system. Thus, conventionally, much time is necessary for the calculation process. Otherwise, to create a large calculation program is necessary.
For example, a numerical control technique used for a machine tool and a three (3)-dimensional coordinate measuring machine may be applied to a surface texture measuring machine. For the setting of the workpiece coordinate system necessary for such an application, it is necessary to execute the setting of the origin of the workpiece coordinate system using a calculation method of intersections based on the conventional form analysis. Thus, conventionally, much time is necessary for the process. Otherwise, to create a large calculation program is necessary when the numerical control technique used for a machine tool etc. is tried to apply to a surface texture measuring machine.
In other words, when a surface texture measurement of a workpiece is carried out using the numerical control technique, it is a premise that the origin of the workpiece coordinate system is defined correctly. However, in a surface texture measurement, minute areas and minute shapes are often handled generally. Furthermore, since there are cases where a workpiece itself is very small, it is very difficult to determine at which point of the workpiece the origin should be set because visual confirmation is difficult. Therefore, conventionally, it is necessary to collect data over a relatively large area of the workpiece surface and obtain the position of the origin based on the result of the form analysis. However, conventionally, much time is necessary for measurement and much time is also necessary for the form analysis process. When the shape of the feature area is complicated, it may be approximated to a simple shape and sufficient accuracy can not be obtained in that case. Furthermore, very sufficient accuracy can not be obtained even when a complicated form analysis has been executed.